package panel.collect
{
	import assists.Lang;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Sprite;
	import flash.display.Stage;
	
	import inerface.ICollect;
	
	import main.ClientConstants;
	
	import panel.eating.DragContainerBox;
	import panel.eating.GetMoreBox;
	import panel.publicPanel.NavigationBar;
	import panel.eating.EatingRestaurantBox;
	
	public class CollectPanel extends Sprite implements ICollect
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _lang:Lang;
		private var _uri:URI;
		
		private var dragContainer:DragContainerBox;
		private var _guideBtns:NavigationBar;
		private var _shopBtnList:Array = [];
		public function CollectPanel()
		{
			super();
		}
		
		public function init(stage:Stage, loader:ResourceLoader, lang:Lang, uri:URI=null):void
		{
			_stage = stage;
			_loader = loader;
			_lang = lang;
			_uri = uri;
			
			_guideBtns = new NavigationBar(_loader,_stage);
			_guideBtns.show([{label:"景区",func:new Function()},{label:"商家",func:new Function()},{label:"小吃",func:new Function()}]);
			_guideBtns.y = _stage.stageHeight * ClientConstants.HOME_UP_PER;
			this.addChild(_guideBtns);
			
			dragContainer = new DragContainerBox(_stage.stageWidth,_stage.stageHeight - _guideBtns.height - _guideBtns.y,new GetMoreBox(_stage,_loader,_lang,new Function()));           //拖动对象添加容器
			dragContainer.x = 0;
			dragContainer.y = _guideBtns.y +　_guideBtns.height;
			this.addChild(dragContainer);
		}
		
		public function show(list:Array):void
		{
			for(var i:int = 0;i < list.length;i++){
				var box:EatingRestaurantBox;
				if(!_shopBtnList[i]){
					box = new EatingRestaurantBox(_loader,_lang,_stage.stageWidth,_stage.stageHeight * .15,_uri);
//					box.showDetail = showDetail;
//					box.clearRecord = clearRecord;
//					box.mapGuide = showMapLocation;
					_shopBtnList.push(box);
				}else{
					box = _shopBtnList[i];
				}
				box.changeData(list[i]);
		}
		}
			
		
		public function clear():void
		{
		}
	}
}